// 视频会议相关类型定义

export interface User {
    id: string;
    name: string;
    isAudioOn: boolean;
    isVideoOn: boolean;
    isScreenSharing: boolean;
    isHost?: boolean; // 是否是主持人
}

export interface Message {
    id: string;
    senderId: string;
    senderName: string;
    content: string;
    timestamp: Date;
}

export interface MediaStateChange {
    userId: string;
    roomId: string;
    isVideoOn?: boolean;
    isAudioOn?: boolean;
}

export interface ScreenShareState {
    userId: string;
    roomId: string;
    isScreenSharing: boolean;
}

export interface PeerConnection {
    connection: RTCPeerConnection;
    isScreenSharing: boolean;
}

export interface JoinRoomData {
    roomId: string;
    userId: string;
    userName: string;
    isHost?: boolean; // 是否是房间创建者（主持人）
}

export interface UserJoinedData {
    userId: string;
    userName: string;
    users: User[];
    isHost?: boolean; // 是否是主持人
}

export interface OfferData {
    to: string;
    from: string;
    offer: RTCSessionDescriptionInit;
}

export interface AnswerData {
    to: string;
    from: string;
    answer: RTCSessionDescriptionInit;
}

export interface IceCandidateData {
    to: string;
    from: string;
    candidate: RTCIceCandidateInit;
}

export interface UserLeftData {
    userId: string;
    users: User[];
}

export interface ChatMessageData {
    roomId: string;
    message: Message;
}

// 房间错误信息
export interface RoomError {
    type: 'room-full' | 'room-not-found' | 'join-failed' | 'permission-denied';
    message: string;
}

// 房间信息
export interface RoomInfo {
    roomId: string;
    hostId: string;
    hostName: string;
    maxParticipants: number;
    currentParticipants: number;
    createdAt: Date;
}

